var gblContentWidth = 1000;

function onloadcontent()
{
	
}

function redirectTo(url)
{
	window.location = url;
}

function openObjectSelectWindow(objName, selectType, cb, cond)
{
	var windowWidth = 640;
	var windowHeight = 480;
	var windowTop = (window.screen.height - windowHeight) / 2;
	var windowLeft = (window.screen.width - windowWidth) / 2;
	
	window.open("/pub/objselectlist.php?obj_name=" + objName + "&select_type=" + selectType + "&cb=" + cb + "&cond=" + cond, 
		"ObjectSelectWindow", 
		"height=" + windowHeight + ", scrollbars=yes, width=" + windowWidth + ", top=" + windowTop + ", left=" + windowLeft + ", toolbar=no, menubar=no, resizable=no,location=no, status=no");
}

function openFileSelectWindow(cb)
{
	var windowWidth = 640;
	var windowHeight = 480;
	var windowTop = (window.screen.height - windowHeight) / 2;
	var windowLeft = (window.screen.width - windowWidth) / 2;
	
	window.open("/pub/fileselectlist.php?cb=" + cb, 
		"FileSelectWindow", 
		"height=" + windowHeight + ", scrollbars=yes, width=" + windowWidth + ", top=" + windowTop + ", left=" + windowLeft + ", toolbar=no, menubar=no, resizable=no,location=no, status=no");
}

function openChangePasswordWindow(userId)
{
	var windowWidth = 450;
	var windowHeight = 150;
	var windowTop = (window.screen.height - windowHeight) / 2;
	var windowLeft = (window.screen.width - windowWidth) / 2;
	
	window.open("/login/passwordchange.php?user_id=" + userId, 
		"ChangePasswordWindow", 
		"height=" + windowHeight + ", width=" + windowWidth + ", top=" + windowTop + ", left=" + windowLeft + ", toolbar=no, menubar=no, resizable=no,location=no, status=no");
}

function openServerStartStopStatusWindow(flag)
{
	var windowWidth = 450;
	var windowHeight = 150;
	var windowTop = (window.screen.height - windowHeight) / 2;
	var windowLeft = (window.screen.width - windowWidth) / 2;
	
	window.open("/pub/startserver.php?flag=" + flag, 
		"ServerStartStopWindow", 
		"height=" + windowHeight + ", width=" + windowWidth + ", top=" + windowTop + ", left=" + windowLeft + ", toolbar=no, menubar=no, resizable=no,location=no, status=no");
}

function refreshPage()
{
	window.location.reload();
}

function GetAJAXObject()
{  
	try
    {    // Firefox, Opera 8.0+, Safari    
    	xmlHttp=new XMLHttpRequest();    
    }
  	catch (e)
    {   // Internet Explorer    
    	try
      	{
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
      	}
    	catch (e)
      	{      
      		try
        	{
        		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
        	}
			catch (e)
			{
				return false;
			}
		}
	}
	return xmlHttp;
}

function CallAjaxFunction(url)
{
	var xmlHttp = GetAJAXObject();
	xmlHttp.open("GET", url, false);
	xmlHttp.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	xmlHttp.send(null);
	var ret = xmlHttp.responseText+"";
	xmlHttp = null;
	var res = eval("("+ret+")");

	return res;
}

function GetAbsoluteLocation(element) 
{ 
	if ( arguments.length != 1 || element == null ) 
	{ 
		 return null; 
	} 
	 var elmt = element; 
	var offsetTop = elmt.offsetTop; 
	var offsetLeft = elmt.offsetLeft; 
	var offsetWidth = elmt.offsetWidth; 
	var offsetHeight = elmt.offsetHeight; 
	while( elmt = elmt.offsetParent ) 
	{ 
		// add this judge 
		if ( elmt.style.position == 'absolute' || elmt.style.position == 'relative'  
			|| ( elmt.style.overflow != 'visible' && elmt.style.overflow != '' ) ) 
		{ 
			break; 
		}  
		offsetTop += elmt.offsetTop; 
		offsetLeft += elmt.offsetLeft; 
	} 
	return { absoluteTop: offsetTop, absoluteLeft: offsetLeft, 
		offsetWidth: offsetWidth, offsetHeight: offsetHeight }; 
} 